{extend name="layout" /}
{block name="content"}
<div class="mui-content">
	<form id="formid" method="post">
	<div class="tm-df-size">
		<div class="tm-label tm-font-gray">
			<div class="main-content">
				<span>基本信息</span>
			</div>
		</div>
		<ul class="mui-table-view max no">
			<li class="mui-table-view-cell">
				<div class="tm-cell-pad">
					<div class="tm-flex flex-align-center">
						<div class="tm-flex-1">
							<span class="tm-font-bold">获得时间</span>
						</div>
						<div class="tm-icon-item">
							<div class="tm-icon-label" style="text-align: right;">
								<!-- <span class="tm-font-gray">2017-11-01</span> -->
								<input class="tm-font-gray" type="date" name="getdate" value="{:date('Y-m-d')}" style="height: 30px;border: none;text-align: right;">
							</div>
							<div class="tm-icon">
								<img src="{$images_path}xinxin.png" alt="" width="6" height="6"/>
							</div>
						</div>
					</div>
				</div>
			</li>
		</ul>
	</div>
	
	<div class="tm-df-size">
		<div class="tm-label tm-font-gray">
			<div class="main-content">
				<span>客户信息</span>
			</div>
		</div>
		<ul class="mui-table-view max">
			<li class="mui-table-view-cell">
				<div class="tm-cell-pad">
					<div class="tm-flex flex-align-center">
						<div class="tm-flex-1">
							<span class="tm-font-bold">客户姓名</span>
						</div>
						<div class="tm-icon-item">
							<div class="tm-icon-label">
								<!-- <span class="tm-font-gray"></span> -->
								<input class="tm-font-gray" type="text" name="name" value="" style="width: 200px;height: 30px;border: none;text-align: right;">
							</div>
							<div class="tm-icon">
								<img src="{$images_path}xinxin.png" alt="" width="6" height="6"/>
							</div>
						</div>
					</div>
				</div>
			</li>
			<li class="mui-table-view-cell">
				<div class="tm-cell-pad">
					<div class="tm-flex flex-align-center">
						<div class="tm-flex-1">
							<span class="tm-font-bold">线索分类</span>
						</div>
						<div class="tm-icon-item">
							<div class="tm-icon-label">
								<select name="kind" onchange="set_client_kind(this, this.value)" style="height: 30px;padding: 2px;margin-right: 25px;padding-left: 100px;">
									<option value="">请选择</option>
									{volist name=":config('CLIENT_KIND')" id="v"}
									<option value="{$key}">{$v}</option>
									{/volist}
								</select>
							</div>
							<div class="tm-icon">
								<img src="{$images_path}xinxin.png" alt="" width="6" height="6"/>
							</div>
						</div>
					</div>
				</div>
			</li>
			<li class="mui-table-view-cell" style="display: none;">
				<div class="tm-cell-pad">
					<div class="tm-flex flex-align-center">
						<div class="">
							<span class="tm-font-bold">意向产品</span>
						</div>
						<div class="tm-icon-item" style="width: 50%;margin-left: 36%;">
							<div class="tm-icon-label" style="width: 100%;">
								<select name="cartypeid1" style="width: 30%;height: 30px;padding: 2px;" onchange="get_cartype(this, this.value)">
									<option value="">请选择</option>
									<!-- {volist name=":get_model_func('Cartype', 'list_datad', ['pid'=>0, 'hide'=>0], 1, 300, 'id,title', 'listorder asc,id asc')" id="v"} -->
									{volist name=":get_model_func('Cartype', 'list_datad', ['id'=>157])" id="v"}
									<option value="{$v.id}">{$v.title}</option>
									{/volist}
								</select>
								<select name="cartypeid2" style="width: 50%;height: 30px;padding: 2px;">
									<option value="">请选择</option>
								</select>
								<!-- <select name="cartypeid3" style="width: 70px;height: 30px;padding: 2px;" onchange="get_car(this, this.value)">
									<option value="">请选择</option>
								</select>
								<select name="carid" style="width: 75px;height: 30px;padding: 2px;">
									<option value="">请选择</option>
								</select> -->
								<div class="tm-icon" style="float: right;margin-top: 5%;">
									<img src="{$images_path}xinxin.png" alt="" width="6" height="6"/>
								</div>
							</div>							
						</div>
					</div>
				</div>
			</li>
			<li class="mui-table-view-cell">
				<div class="tm-cell-pad">
					<div class="tm-flex flex-align-center">
						<div class="tm-flex-1">
							<span class="tm-font-bold">联系电话</span>
						</div>
						<div class="tm-icon-item">
							<div class="tm-icon-label">
								<!-- <span class="tm-font-gray"></span> -->
								<input class="tm-font-gray" type="text" name="phone" value="" style="width: 200px;height: 30px;border: none;text-align: right;">
							</div>
							<div class="tm-icon">
								<img src="{$images_path}xinxin.png" alt="" width="6" height="6"/>
							</div>
						</div>
					</div>
				</div>
			</li>
			<!-- <li class="mui-table-view-cell">
				<div class="tm-cell-pad">
					<div class="tm-flex flex-align-center">
						<div class="tm-flex-1">
							<span class="tm-font-bold">社交账号</span>
						</div>
						<div class="tm-icon-item">
							<div class="tm-icon-label">
								<input class="tm-font-gray" type="text" name="qq" value="" style="width: 200px;height: 30px;border: none;text-align: right;">
							</div>
						</div>
					</div>
				</div>
			</li> -->
			<li class="mui-table-view-cell">
				<div class="tm-cell-pad">
					<div class="tm-flex flex-align-center">
						<div class="tm-flex-1">
							<span class="tm-font-bold">地址</span>
						</div>
						<div class="tm-icon-item">
							<div class="tm-icon-label">
								<input id='home-picker' class="tm-font-gray" type="text" name="home" value="陕西省 西安市 新城区" style="width: 200px;height: 30px;border: none;text-align: right;">
							</div>
						</div>
					</div>
				</div>
			</li>
			{eq name="uinfo.roleid" value="9"}
			<li class="mui-table-view-cell">
				<div class="tm-cell-pad">
					<div class="tm-flex flex-align-center">
						<div class="tm-flex-1">
							<span class="tm-font-bold">客户状态</span>
						</div>
						<div class="tm-icon-item">
							<div class="tm-icon-label">
								<select name="typeid" style="height: 30px;padding: 2px;margin-right: 25px;padding-left: 100px;" disabled>
									<option value="">请选择</option>
									{volist name=":config('CLIENT_TYPE')" id="v"}
									<option value="{$key}" {eq name="key" value="1"} selected {/eq}>{$v}</option>
									{/volist}
								</select>
							</div>
						</div>
					</div>
				</div>
			</li>
			{else /}
			<li class="mui-table-view-cell">
				<div class="tm-cell-pad">
					<div class="tm-flex flex-align-center">
						<div class="tm-flex-1">
							<span class="tm-font-bold">客户状态</span>
						</div>
						<div class="tm-icon-item">
							<div class="tm-icon-label">
								<select name="typeid" style="height: 30px;padding: 2px;margin-right: 25px;padding-left: 100px;">
									<option value="">请选择</option>
									{volist name=":config('CLIENT_TYPE')" id="v"}
									<option value="{$key}">{$v}</option>
									{/volist}
								</select>
							</div>
						</div>
					</div>
				</div>
			</li>
			{/eq}
			<li class="mui-table-view-cell">
				<div class="tm-cell-pad">
					<div class="tm-flex flex-align-center">
						<div class="tm-flex-1">
							<span class="tm-font-bold">客户级别</span>
						</div>
						<div class="tm-icon-item">
							<div class="tm-icon-label">
								<select name="skilled" style="height: 30px;padding: 2px;margin-right: 25px;padding-left: 100px;">
									<option value="">请选择</option>
									{volist name=":config('CLIENT_SKILLED')" id="v"}
									<option value="{$key}">{$v}</option>
									{/volist}
								</select>
							</div>
						</div>
					</div>
				</div>
			</li>
			<li class="mui-table-view-cell">
				<div class="tm-cell-pad">
					<div class="tm-flex flex-align-center">
						<div class="tm-flex-1">
							<span class="tm-font-bold">备注</span>
						</div>
						<div class="tm-icon-item">
							<div class="tm-icon-label">
								<input class="tm-font-gray" type="text" name="remark" value="" style="width: 200px;height: 30px;border: none;text-align: right;">
							</div>
						</div>
					</div>
				</div>
			</li>
		</ul>
		<div class="uk-margin-large-top uk-text-center">
            <button class="mui-btn mui-btn-green btn-radiu-large pay-btn cocoPostFormAjax" formid="formid" ajaxurl="{:url('v2/client/add')}" type="button" style="width: 90%; height: 45px;" ajax-callback="suc_back">
                保存
            </button>
 
        </div>
	</div>
	<input type="hidden" name="formid" value="{$formid}">
	</form>
</div>
{/block}
{block name="script"}
<script src="{$js_path}jquery-weui.min.js"></script>
<script src="{$js_path}components/sticky.min.js"></script>
<script src="{$js_path}swiper.min.js"></script>
<script src="{$js_path}city-picker.min.js?v=6" charset="utf-8"></script>
<script src="{$js_path}main.js"></script>
<script>
	$("#home-picker").cityPicker({
		title: "选择所在城市",
		onChange: function(picker, values, displayValues) {
		}
	});
</script>
<script type="text/javascript">
	function set_client_kind(obj, type) {
		if (type == 'gouche') {
			$(obj).parent().parent().parent().parent().parent().next().show();
		}else{
			$(obj).parent().parent().parent().parent().parent().next().hide();
		}
	}
	function get_cartype(obj, pid) {
		$.post("{:url('v2/index/get_cartype')}", {pid: pid}, function(datajson) {
			var data = datajson.response;
			if (!data) {
				return false;
			}
			var html = '<option value="">请选择</option>';
			$.each(data, function(index, item) {
				html += '<option value="'+item.id+'">'+item.title+'</option>';
			});
			$(obj).next().html('');
			$(obj).next().append(html);
		});
	}
	function get_car(obj, pid) {
		$.post("{:url('v2/index/get_car')}", {pid: pid}, function(datajson) {
			var data = datajson.response;
			if (!data) {
				return false;
			}
			var html = '<option value="">请选择</option>';
			$.each(data, function(index, item) {
				html += '<option value="'+item.id+'">'+item.title+'</option>';
			});
			$(obj).next().html('');
			$(obj).next().append(html);
		});
	}
	function suc_back(obj, data) {
   		coco_msg('保存成功');
		setTimeout(function() {
			wx.miniProgram.navigateBack();
		}, 500);
   }
</script>
{/block}